const hx = require('hbuilderx');
const {
    copyDone,
    copyFailed
} = require("./i18n")

export function writeToClipboard(text, showText = false) {
    hx.env.clipboard.writeText(text).then(() => {
        hx.window.showToast({message: `✅✅✅${copyDone}${showText&&!!text ? `:${text}` : ""}`});
    }).catch(() => {
        hx.window.showToast({message: `❌❌❌${copyFailed}`});
    });
}